import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { WindowEvent } from "../../../component/window/WindowEvent";
import { ObjCreate } from "../common/ObjCreate";
import { TitleItem } from "../common/item/TitleItem";
import { ObjTeamCreate } from "../common/ObjTeamCreate";
import { MarryLogCell } from "./cellRenderer/MarryLogCell";
import { PageSelecter } from "../common/pageSelect/PageSelecter";
import { PageData } from "../arena/ArenaData/PageData";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { MarryHistoryData } from "./defin/MarryHistoryData";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { GTileList } from "../../../../com/mui/controls/GTileList";
type int = number;
//class MarryLog
    
    export  class MarryLog extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(566, 381);
            titleHeight = 26;
            title = Language.getString(43621);
            this.addEventListener(WindowEvent.SHOW, this.onWindowShow);
            return;
        }

        /* internal  */onWindowShow(arg1: WindowEvent): void
        {
            this.getLogData();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(18, 39, 530, 330, this);
            var loc1=new Vector.<TitleItem>();
            loc1.push(new TitleItem(Language.getString(43622), 130));
            loc1.push(new TitleItem(Language.getString(43623), 390));
            var loc2=ObjTeamCreate.createTitles(loc1);
            ObjCreate.setObjAttri(loc2, 30, 47, -1, -1, this);
            this._LogList = ObjCreate.createTileList(25, 70, 520, 265, this);
            this._LogList.columnWidth = 520;
            this._LogList.rowHeight = 33;
            this._LogList.setStyle("cellRenderer", MarryLogCell);
            this._pageSelecter = ObjCreate.createPageSelecter(222, 340, this, PageSelecter.CompleteMode);
            this._pageSelecter.addEventListener(flash.events.Event.CHANGE, this.onPageChange);
            return;
        }

        /* internal  */onPageChange(arg1: Object /* flash.events.Event */): void
        {
            this.getLogData();
            return;
        }

        /* internal  */getLogData(): void
        {
            var loc1=new PageData(this.PageSize, this._pageSelecter.currentPage);
            Dispatcher.dispatchEvent(new DataEvent(EventName.MarryGetLog, loc1));
            return;
        }

        public updateLog(arg1: MarryHistoryData): void
        {
            this._pageSelecter.maxPage = arg1.maxPage;
            this._LogList.dataProvider = new DataProvider(arg1.historys);
            return;
        }

        /* internal */ /* const */PageSize: int=8;

        /* internal */ /* var */_LogList: GTileList;

        /* internal */ /* var */_pageSelecter: PageSelecter;
    }
